<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<h:head>
	<title>Modifica profilo</title>
	<link href="resources/css/main.css" rel="stylesheet" type="text/css" />
</h:head>
<h:body>
	<header>
		<a><h:link class="logo" outcome="index" /></a>
	</header>
	<div id="container">
		<div id="content">
	<h:form id="modificaProfiloForm" onsubmit="#{userBean.populate()}">
		<p:growl id="messages" showDetail="true"/>
		<h:panelGrid id="modificaProfiloGrid" columns="3" cellpadding="4" >
		            <f:facet name="header">  
		                  <h:outputText style="font-weight:bold" value="Modifica profilo per #{userBean.name}"/>
		            </f:facet>
		  
		            <h:outputLabel for="nome">Nome:</h:outputLabel>
					<p:inputText id="nome" value="#{userBean.user.firstName}" />
					<p:message for="nome" />
					
					<h:outputLabel for="cognome">Cognome:</h:outputLabel>
					<p:inputText id="cognome" value="#{userBean.user.lastName}" />
					<p:message for="cognome" />
					
					<h:outputLabel for="vecchiaPassword">Vecchia password:</h:outputLabel>
					<p:password id="vecchiaPassword" label="Vecchia passowrd" value="#{userBean.vecchiaPassword}"/>
					<p:message for="vecchiaPassword" />
					
					<h:outputLabel for="password">Nuova password:</h:outputLabel>
					<p:password id="password" label="Password" value="#{userBean.password}"/>
					<p:message for="password" />
					
					<h:outputLabel for="password2">Conferma password:</h:outputLabel>
					<p:password id="password2" label="Ripeti password" value="#{userBean.password2}"/>
					<p:message for="password2" />
					
		            <p:commandButton id="modificaProfiloButton" icon="ui-icon-pencil" title="Modifica" update=":modificaProfiloForm:messages"
		            				 action="#{userBean.modificaUser()}"/>
		            
	        	</h:panelGrid>
		   
	</h:form>
	</div>
	</div>
</h:body>
</html>